from keras import layers, models


def create_block(num_convs, num_filters):
    m = models.Sequential()
    for _ in num_convs:
        m.add(layers.Conv2D(num_filters, (3, 3), activation='relu', padding='same'))

    m.add(layers.MaxPooling2D((2, 2), strides=(2, 2)))
    return m


def create_vgg_model(num_convs_filters):
    m = models.Sequential()
    for (num_conv, num_filters) in num_convs_filters:
        m.add(create_block(num_conv, num_filters))

    # m.add(layers.Flatten())
    # m.add(layers.Dense(4096, activation='relu'))
    # m.add(layers.Dropout(0.5))
    # m.add(layers.Dense(4096, activation='relu'))
    # m.add(layers.Dropout(0.5))
    # m.add(layers.Dense(1000, activation='softmax'))
    m.add(models.Sequential([
        layers.Flatten(),
        layers.Dense(4096, activation='relu'),
        layers.Dropout(0.5),
        layers.Dense(4096, activation='relu'),
        layers.Dropout(0.5),
        layers.Dense(1000, activation='softmax')
    ]))
    return m


num_convs_filters = ((2, 64), (2, 128), (3, 256), (3, 512), (3, 512))
m = create_vgg_model(num_convs_filters)
